package xin.marcher.module.inventory.mq.producer;

import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import xin.marcher.module.common.constants.RocketMqConstant;
import xin.marcher.module.inventory.domain.request.InventorOfflineRequest;

/**
 * 分桶下线的消息队列
 *
 *
 */
@Slf4j
@Component
public class BucketOfflineProducer {

    @Autowired
    private DefaultProducer defaultProducer;

    /**
     * 分桶下线的消息 MQ生产
     *
     * @param inventorOfflineRequest
     */
    public void sendBucketOffline(InventorOfflineRequest inventorOfflineRequest) {
//        log.error("发送分桶下线消息：{}", JSON.toJSONString(inventorOfflineRequest.getBucketNoList()));
        //发送分桶下线消息
        defaultProducer.sendMessage(RocketMqConstant.BUCKET_OFFLINE_TOPIC,
                JSONObject.toJSONString(inventorOfflineRequest), "分桶下线");
    }
}
